/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author lzw
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface FstAppointCase extends BasicModel<FstAppointCase> {
  caseSource?: string; // 案件来源
  caseBatch?: string; // 案件批次
  caseNumber?: number; // 案件量
  caseHouseholds?: number; // 案件户数
  maxClientCaseNum?: string; // 客户最高共债量
  minClientCaseNum?: string; // 客户最低共债量
  batchCaseSumMoney?: number; // 批次案件总金额
  batchCaseAgeMoney?: number; // 批次案件平均金额
  ps?: string; // 政策描述
  amountCashed?: number; // 回款金额
  ratio?: string; // 回款占比
  parentId?: string; // 上级id
}

export const fstAppointCaseList = (params?: FstAppointCase | any) =>
  defHttp.get<FstAppointCase>({ url: adminPath + '/operating/fstAppointCase/list', params });

export const fstAppointCaseListData = (params?: FstAppointCase | any) =>
  defHttp.post<Page<FstAppointCase>>({ url: adminPath + '/operating/fstAppointCase/listData', params });

export const fstAppointCaseForm = (params?: FstAppointCase | any) =>
  defHttp.get<FstAppointCase>({ url: adminPath + '/operating/fstAppointCase/form', params });

export const fstAppointCaseSave = (params?: any, data?: FstAppointCase | any) =>
  defHttp.postJson<FstAppointCase>({ url: adminPath + '/operating/fstAppointCase/save', params, data });

export const fstAppointCaseImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/operating/fstAppointCase/importData',
      onUploadProgress,
    },
    params,
  );

export const fstAppointCaseDelete = (params?: FstAppointCase | any) =>
  defHttp.get<FstAppointCase>({ url: adminPath + '/operating/fstAppointCase/delete', params });
